package com.myzl.web.controller.visualization;

import com.myzl.coal.service.IMongoHistoryDataService;
import com.myzl.common.core.domain.AjaxResult;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 * @date 2023年6月16日10:08:19
 */
@RestController
@Slf4j
@Data
@RequestMapping("/visualization/sensor/")
public class SensorController {

    private final IMongoHistoryDataService mongoHistoryDataService;

    @GetMapping("/power")
    public AjaxResult powerTrend(@RequestParam(defaultValue = "103") Integer deviceId) {
        Map<String, List<String>> stringListMap = mongoHistoryDataService.thirtyPowerTrend(deviceId);
        return AjaxResult.success(stringListMap);
    }
    @GetMapping("/temperature")
    public AjaxResult temperatureTrend(@RequestParam(defaultValue = "103") Integer deviceId) {
        Map<String, List<String>> stringListMap = mongoHistoryDataService.thirtyTemperatureTrend(deviceId);
        return AjaxResult.success(stringListMap);
    }

}
